#!/bin/bash -i

#PS1='$ '
#source ~/.bashrc

#export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64
#export SONAR_RUNNER_HOME=/usr/local/sonar-runner
#export PATH=$PATH:$SONAR_RUNNER_HOME/bin

roscd csapex

INCLUDE=$(roscd; cd ..; cat build/csapex/src/csapex/includes.txt)
INCLUDE=-I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I/usr/include/qt5/QtCore -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtWidgets -I/usr/include/qt5 -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I/usr/include/qt5/QtCore -I/usr/include/qt5/QtGui -I/usr/include/qt5 -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I/usr/include/qt5/QtCore -I/usr/include/qt5 -I/usr/include -I/usr/include -I/usr/include -I/home/buck/ws/apex/src/csapex/src/csapex/external/qxt5/include -I/home/buck/ws/apex/src/csapex/src/csapex/include -I/home/buck/ws/apex/build/csapex/src/csapex -I/home/buck/ws/apex/src/csapex/src/csapex/include -I/home/buck/ws/apex/src/csapex/src/csapex/src
INCLUDE=

SOURCE=$(find . -name '*.cpp' -o -name '*.h' -o -name '*.hpp' -o -name '*.c')
#SOURCE=include/csapex/command/update_parameter.h #src/csapex.cpp
#SOURCE=src/command/update_parameter.cpp #src/csapex.cpp
mkdir reports -p
REPORT_PATH=$(cd reports; pwd)

#strace cppcheck -v --std=c++11 --enable=all --xml $INCLUDE $SOURCE 
#cppcheck -j 4 --platform=unix64 -UWIN32 --force -v --std=c++11 --enable=all --xml $INCLUDE $SOURCE 2> $REPORT_PATH/cppcheck.xml
cppcheck -j 10 --platform=unix64 -UWIN32 -v --force \
-UBOOST_DISABLE_WIN32 -UBOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS -UBOOST_NO_STDC_NAMESPACE \
-UBOOST_NO_STD_TYPEINFO \
-UBOOST_ASSERT_CONFIG -UBOOST_NO_STD_MIN_MAX \
-UBOOST_ABI_PREFIX \
-UBOOST_DETECT_OUTDATED_WORKAROUNDS \
-UBOOST_DINKUMWARE_STDLIB \
-UBOOST_DISABLE_ABI_HEADERS \
-UBOOST_HAS_HASH \
-UBOOST_HAS_INT128 \
-UBOOST_HAS_LONG_LONG \
-UBOOST_HAS_MACRO_USE_FACET \
-UBOOST_HAS_SLIST \
-UBOOST_HAS_STLP_USE_FACET \
-UBOOST_HAS_THREADS \
-UBOOST_HAS_TWO_ARG_USE_FACET \
-UBOOST_ILLEGAL_CV_REFERENCES \
-UBOOST_INTEL \
-UBOOST_INTEL_CXX_VERSION \
-UBOOST_INTEL_WIN \
-UBOOST_MPL_CFG_BROKEN_OVERLOAD_RESOLUTION \
-UBOOST_MPL_PREPROCESSING_MODE \
-UBOOST_MSVC \
-UBOOST_MSVC \
-UBOOST_MSVC_FULL_VER \
-UBOOST_NO_ARGUMENT_DEPENDENT_LOOKUP \
-UBOOST_NO_CV_SPECIALIZATIONS \
-UBOOST_NO_CWCHAR \
-UBOOST_NO_CXX11_AUTO_DECLARATIONS \
-UBOOST_NO_CXX11_AUTO_MULTIDECLARATIONS \
-UBOOST_NO_CXX11_CHAR16_T \
-UBOOST_NO_CXX11_CHAR32_T \
-UBOOST_NO_CXX11_CONSTEXPR \
-UBOOST_NO_CXX11_DECLTYPE \
-UBOOST_NO_CXX11_DECLTYPE_N3276 \
-UBOOST_NO_CXX11_DEFAULTED_FUNCTIONS \
-UBOOST_NO_CXX11_DELETED_FUNCTIONS \
-UBOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS \
-UBOOST_NO_CXX11_EXTERN_TEMPLATE \
-UBOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS \
-UBOOST_NO_CXX11_HDR_ARRAY \
-UBOOST_NO_CXX11_HDR_CHRONO \
-UBOOST_NO_CXX11_HDR_CODECVT \
-UBOOST_NO_CXX11_HDR_CONDITION_VARIABLE \
-UBOOST_NO_CXX11_HDR_FORWARD_LIST \
-UBOOST_NO_CXX11_HDR_FUTURE \
-UBOOST_NO_CXX11_HDR_INITIALIZER_LIST \
-UBOOST_NO_CXX11_HDR_MUTEX \
-UBOOST_NO_CXX11_HDR_RANDOM \
-UBOOST_NO_CXX11_HDR_RATIO \
-UBOOST_NO_CXX11_HDR_REGEX \
-UBOOST_NO_CXX11_HDR_SYSTEM_ERROR \
-UBOOST_NO_CXX11_HDR_THREAD \
-UBOOST_NO_CXX11_HDR_TUPLE \
-UBOOST_NO_CXX11_HDR_TYPEINDEX \
-UBOOST_NO_CXX11_HDR_TYPE_TRAITS \
-UBOOST_NO_CXX11_HDR_UNORDERED_MAP \
-UBOOST_NO_CXX11_HDR_UNORDERED_SET \
-UBOOST_NO_CXX11_LAMBDAS \
-UBOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS \
-UBOOST_NO_CXX11_NOEXCEPT \
-UBOOST_NO_CXX11_NULLPTR \
-UBOOST_NO_CXX11_NUMERIC_LIMITS \
-UBOOST_NO_CXX11_RAW_LITERALS \
-UBOOST_NO_CXX11_RVALUE_REFERENCES \
-UBOOST_NO_CXX11_SCOPED_ENUMS \
-UBOOST_NO_CXX11_STATIC_ASSERT \
-UBOOST_NO_CXX11_VARIADIC_MACROS \
-UBOOST_NO_CXX11_STATIC_ASSERT \
-UBOOST_NO_CXX11_STD_UNORDERED \
-UBOOST_NO_CXX11_TEMPLATE_ALIASES \
-UBOOST_NO_CXX11_UNICODE_LITERALS \
-UBOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX \
-UBOOST_NO_CXX11_VARIADIC_MACROS \
-UBOOST_NO_CXX11_VARIADIC_TEMPLATES \
-UBOOST_NO_DEDUCED_TYPENAME \
-UBOOST_NO_EXCEPTIONS \
-UBOOST_NO_INCLASS_MEMBER_INITIALIZATION \
-UBOOST_NO_INTRINSIC_WCHAR_T \
-UBOOST_NO_LIMITS \
-UBOOST_NO_MEMBER_TEMPLATES \
-UBOOST_NO_MEMBER_TEMPLATE_FRIENDS \
-UBOOST_NO_MEMBER_TEMPLATE_KEYWORD \
-UBOOST_NO_SFINAE \
-UBOOST_NO_STD_LOCALE \
-UBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION \
-UBOOST_NO_TYPEID \
-UBOOST_NO_TYPENAME_WITH_CTOR \
-UBOOST_NO_UNREACHABLE_RETURN_DETECTION \
-UBOOST_RWSTD_VER \
-UBOOST_STRICT_CONFIG \
--std=c++11 --enable=all --xml $INCLUDE $SOURCE 2> $REPORT_PATH/cppcheck.xml
#/usr/local/cppncss/bin/cppncss -DO_OBJECT -MQ_DECLARE_METATYPE -r -v -x -k -f=$REPORT_PATH/cppncss.xml $SOURCE

sonar-runner
